var GameUILayer = cc.Layer.extend({
    isMouseDown:false,

    ccbNode:null,

    rectsInited:false,

    init:function () {

        //////////////////////////////
        // 1. super init first
        this._super();
        this.setTouchEnabled(true);
        /////////////////////////////
        // 2. add a menu item with "X" image, which is clicked to quit the program
        //    you may modify it.
        // ask director the window size
        var size = cc.Director.getInstance().getVisibleSize();
        var size2 =  cc.Director.getInstance().getWinSize();

        cc.BuilderReader.setResourcePath("ccb/");

        //load ccbi scene
        this.ccbNode = cc.BuilderReader.load("ccb/GameUIScene.ccbi", this);
        //this.ccbNode.animationManager.setCompletedAnimationCallback(this, this.animationCompleteCallback);

        //init scene
        //read record
        /*
            skill1 1
            skill2 2
            skill3 3
            pause 4
            line 5-6
                name 1
                line 2
            actionline 7
                sprite 1 ------ ccbi node

            SingleCharacter:
                character 1
                bloodline 2
                energyline 3
        */
        this.ccbNode.getChildByTag(6).getChildByTag(1).getChildByTag(2).setVisible(false);
        this.ccbNode.getChildByTag(6).getChildByTag(1).getChildByTag(3).setVisible(false);

        // try add a character on map
        var testSprite=new CharacterSprite();
        testSprite.setPosition(cc.p(800,480));
        this.ccbNode.addChild(testSprite);

        if(this.ccbNode != null) {
            this.addChild(this.ccbNode);
        }

        this.initTouchPositions();

        // test
    },
    animationCompleteCallback: function(){
        console.log("animation end...");
    },
    initTouchPositions: function(){
        console.log("init Touch Positions");
        if(!this.rectsInited){
            this.rectsInited=true;
        }
    },
    onTouchesEnded: function(pTouch, pEvent){
        var touchPoint=pTouch[0].getLocation();
        // console.log("touch end",touchPoint);
    },
    onTouchesBegan: function(pTouch, pEvent){
        var touchPoint=pTouch[0].getLocation();
    },
    onTouchesMoved: function(pTouch, pEvent){
        var touchPoint=pTouch[0].getLocation();
    },
});
